home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / lib / buffer.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  3.4 KB  |  108 lines

  1. /*************************************************************************
  2.  *                                                                       *
  3.  *  Copyright (c) 1992, 1993 Ronald Joe Record                           *
  4.  *                                                                       *
  5.  *  All rights reserved. No part of this program or publication may be   *
  6.  *  reproduced, transmitted, transcribed, stored in a retrieval system,  *
  7.  *  or translated into any language or computer language, in any form or *
  8.  *  by any means, electronic, mechanical, magnetic, optical, chemical,   *
  9.  *  biological, or otherwise, without the prior written permission of:   *
  10.  *                                                                       *
  11.  *      Ronald Joe Record (408) 458-3718                                 *
  12.  *      212 Owen St., Santa Cruz, California 95062 USA                   *
  13.  *                                                                       *
  14.  *************************************************************************/
  15.  
  16. #include "libXrr.h"
  17.  
  18. void
  19. BufferInPixmap(display, pixmap, contexts, points, col, x, y)
  20. Display *display;
  21. Pixmap pixmap;
  22. GC *contexts;
  23. points_t *points;
  24. int col, x, y;
  25. {
  26.     if (points->npoints[col] == MAXPOINTS)
  27.     {
  28.         XDrawPoints(display, pixmap, contexts[col],
  29.             points->data[col], points->npoints[col], CoordModeOrigin);
  30.         points->npoints[col] = 0;
  31.     }
  32.     points->data[col][points->npoints[col]].x = x;
  33.     points->data[col][points->npoints[col]].y = y;
  34.     ++points->npoints[col];
  35. }
  36.  
  37. void
  38. BufferPoint(display, window, pixmap, contexts, points, col, x, y)
  39. Display *display;
  40. Window window;
  41. Pixmap pixmap;
  42. GC *contexts;
  43. points_t *points;
  44. int col, x, y;
  45. {
  46.     if (points->npoints[col] == MAXPOINTS)
  47.     {
  48.         XDrawPoints(display, window, contexts[col],
  49.             points->data[col], points->npoints[col], CoordModeOrigin);
  50.         XDrawPoints(display, pixmap, contexts[col],
  51.             points->data[col], points->npoints[col], CoordModeOrigin);
  52.         points->npoints[col] = 0;
  53.     }
  54.     points->data[col][points->npoints[col]].x = x;
  55.     points->data[col][points->npoints[col]].y = y;
  56.     ++points->npoints[col];
  57. }
  58.  
  59. void
  60. InitBuffer(points, maxcolor)
  61. points_t *points;
  62. int maxcolor;
  63. {
  64.     static int i;
  65.  
  66.     for (i = 0 ; i < maxcolor; i++)
  67.         points->npoints[i] = 0;
  68. }
  69.  
  70. void
  71. FlushPixmap(display, pixmap, contexts, points, mincolor, maxcolor)
  72. Display *display;
  73. Pixmap pixmap;
  74. GC *contexts;
  75. points_t *points;
  76. int mincolor, maxcolor;
  77. {
  78.     static int color;
  79.  
  80.     for (color = mincolor; color < maxcolor; ++color)
  81.         if (points->npoints[color]) {
  82.             XDrawPoints(display, pixmap, contexts[color], points->data[color], 
  83.                     points->npoints[color], CoordModeOrigin);
  84.             points->npoints[color] = 0;
  85.         }
  86. }
  87.  
  88. void
  89. FlushBuffer(display, window, pixmap, contexts, points, mincolor, maxcolor)
  90. Display *display;
  91. Window window;
  92. Pixmap pixmap;
  93. GC *contexts;
  94. points_t *points;
  95. int mincolor, maxcolor;
  96. {
  97.     static int color;
  98.  
  99.     for (color = mincolor; color < maxcolor; ++color)
  100.         if (points->npoints[color]) {
  101.             XDrawPoints(display, window, contexts[color], points->data[color], 
  102.                     points->npoints[color], CoordModeOrigin);
  103.             XDrawPoints(display, pixmap, contexts[color], points->data[color], 
  104.                     points->npoints[color], CoordModeOrigin);
  105.             points->npoints[color] = 0;
  106.         }
  107. }
  108.